BEGIN{s="@TYPE XY"}
$0~/^\#/{
  if($1=="#STARTLOOP"){startl=startl""$12" "$13" "$2" "$5" "$9" "$10" #startl i beta E wR lambda cueff\n"};
  if($1=="#ENDLOOP:"){endl=endl""$2" "$3" "$4" "$5" "$7" "$8" #endl E Ueff rate ewt wR R\n"};
#print $0 > "/dev/stderr";
  next;
}
FNR==1{print s;print;d=$3}
FNR>1{if(d!=$3){print "&";print s}print;d=$3}
END{
  print "&";
  printf startl > "/dev/stderr";
  printf endl > "/dev/stderr";
}
